package com.dayfly.tip.dao.impl;

import java.util.List;

import com.dayfly.tip.dao.BaseDAO;
import com.dayfly.tip.dao.RecordDAO;
import com.dayfly.tip.model.RecordDO;
/**
 * 
 * @author dayfly
 *
 */
public class RecordDAOImpl extends BaseDAO implements RecordDAO {

	@Override
	public void record(RecordDO record) {
		this.getSqlMapClientTemplate().insert("create",record);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<RecordDO> getRecordByUserId(long userId) {
		return this.getSqlMapClientTemplate().queryForList("queryByUserId", userId);
	}

	@Override
	public RecordDO getRecordById(long recordId) {
		return (RecordDO) this.getSqlMapClientTemplate().queryForObject("getRecordById", recordId);
	}
	
	public void deleteRecordById(long recordId){
		this.getSqlMapClientTemplate().delete("deleteRecordById", recordId);
	}

	@Override
	public void updateRecord(RecordDO record) {
		this.getSqlMapClientTemplate().update("updateRecord",record);
	}
	
	
}
